package com.application.sistercityapplication.main;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

public class ActionBarSetElementUtil {
	
	int stringActionHeaderText,stringNavigationText;
	public String stringNavigation;
	public Activity _activity;
	public Intent intent;
	public ImageView backButton;
	public ActionBarSetElementUtil(Activity act,Intent _intent){
		this._activity = act;
		this.intent = _intent;
	}
	public ActionBarSetElementUtil(Activity act,int _stringActionHeaderText,int _stringNavigationText,Intent _intent){
		this._activity = act;
		this.stringActionHeaderText = _stringActionHeaderText;
		this.stringNavigationText = _stringNavigationText;
		this.intent = _intent;
	}
	public ActionBarSetElementUtil(Activity act,int _stringActionHeaderText,String _stringNavigationText,Intent _intent){
		this._activity = act;
		this.stringActionHeaderText = _stringActionHeaderText;
		this.stringNavigation = _stringNavigationText;
		this.intent = _intent;
	}
	public void createActionBar(){
		System.gc();
		TextView actionHeader = (TextView) _activity.findViewById(R.id.header_text);
		
		TextView navigationHeader = (TextView) _activity.findViewById(R.id.header_navigation_text);
		actionHeader.setText(_activity.getResources().getString(stringActionHeaderText));

		if(stringNavigationText==0){
			navigationHeader.setText(stringNavigation);
		}else{
			navigationHeader.setText(_activity.getResources().getString(stringNavigationText));
		}
		backButton = (ImageView) _activity.findViewById(R.id.back_icon);
		backButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				_activity.startActivity(intent);
				_activity.finish();
			}
		});
	}
	public void createActionBarForImageView(int pageInit, int PageAll){
		System.gc();
		backButton = (ImageView) _activity.findViewById(R.id.back_icon);
		backButton.setVisibility(View.GONE);
		
	}
}
